#define  _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdbool.h>
#include<stdlib.h>

struct ListNode {
    int val;
    struct ListNode* next;
    
};

struct ListNode* BuyNode(int x)
{
    struct ListNode* a = (struct ListNode*)malloc(sizeof(struct ListNode));
    a->val = x;
    a->next = NULL;
    return a;
}

struct ListNode* lookmid(struct ListNode* A)
{
    struct ListNode* slow = A;
    struct ListNode* fast = A;
    while (fast->next != NULL && fast->next->next != NULL)
    {
        slow = slow->next;
        fast = fast->next->next;
    }
    return slow;
}

struct ListNode* reverse(struct ListNode* mid)
{
    struct ListNode* first = mid;
    struct ListNode* second = NULL;
    while (first->next != NULL)
    {
        struct ListNode* third = first->next;
        first->next = second;
        second = first;
        first = third;
    }
    first->next = second;
    return first;
}

bool chkPalindrome(struct ListNode* A) {
    // write code here
    if (A == NULL || A->next == NULL)
    {
        return true;
    }
    struct ListNode* mid = lookmid(A);
    struct ListNode* last = reverse(mid);

    while (A->next != NULL && last->next != NULL)
    {
        if (A->val != last->val)
        {
            return false;
        }
        A = A->next;
        last = last->next;
    }
    return true;
}

int main()
{
        struct ListNode* a = BuyNode(1);
        
   /*     struct ListNode* b = BuyNode(2);
       
        struct ListNode* c = BuyNode(3);

        struct ListNode* d = BuyNode(3);

        struct ListNode* e = BuyNode(2);

        struct ListNode* f = BuyNode(1);*/
   /* a->next = b;
    b->next = c;
    c->next = d;
    d->next = e;
    e->next = f;*/
    if (chkPalindrome(a))
    {
        printf("yes");
    }
    else
        printf("no");
    return 0;
}